using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;

namespace XPStudio.HR.Model
{
    public class EmployeeModel
    {
        public EmployeeModel()
        { }
        #region Model
        private string _empid;
        private string _empfirstname;
        private string _emplastname;
        private bool _empgender;
        private DateTime _birthdate;
        private DateTime _joindate;
        private string _cardno;
        private string _empstatus;
        private ArrayList _empproperty;
        //private List<> _empproperty;
        
        /// <summary>
        /// 
        /// </summary>
        public string EmpID
        {
            set { _empid = value; }
            get { return _empid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string EmpFirstName
        {
            set { _empfirstname = value; }
            get { return _empfirstname; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string EmpLastName
        {
            set { _emplastname = value; }
            get { return _emplastname; }
        }
        /// <summary>
        /// 
        /// </summary>
        public bool EmpGender
        {
            set { _empgender = value; }
            get { return _empgender; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime BirthDate
        {
            set { _birthdate = value; }
            get { return _birthdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime JoinDate
        {
            set { _joindate = value; }
            get { return _joindate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string CardNO
        {
            set { _cardno = value; }
            get { return _cardno; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string EmpStatus
        {
            set { _empstatus = value; }
            get { return _empstatus; }
        }
        /// <summary>
        /// 
        /// </summary>
        public ArrayList EmpProperty
        {
            set { _empproperty = value; }
            get { return _empproperty; }
        }
        #endregion Model

        public EmployeeProperty this[int index]
        {
            get
            {
                if (index < 0 || index > _empproperty.Count - 1)
                    return null;
                return (EmployeeProperty)_empproperty[index];
            }

            //set
            //{
            //    if (index < 0 || index > _empproperty.Count - 1)
            //        return;
            //    _empproperty.Insert(index, value);
            //}
        }

        public int PropertyCount
        {
            get { return _empproperty.Count; }
        }

        public string FullName
        {
            get { return _empfirstname + _emplastname; }
        }

        public string Birthday
        {
            get
            {
                if (_cardno.Length == 18)
                    return _cardno.Substring(6, 8);
                else
                    return "19" + _cardno.Substring(6, 6);
            }
        }
    }

    /*
    public class EmployeeModels : IEnumerator
    {
        public EmployeeModels()
        { }

        private int _count;
        private ArrayList _employees;

        public IEnumerator GetEnumerator()
        {
            return _employees.GetEnumerator();
        }

        public EmployeeModels(int EmployeeCount)
        {
            _employees = new ArrayList(EmployeeCount);
        }

        public EmployeeModel this[int index]
        {
            get
            {
                if (index < 0 || index > _employees.Count - 1)
                    return null;
                return (EmployeeModel)_employees[index];
            }

        }

        public EmployeeModel this[string CardNo]
        {
            get
            {
                EmployeeModel emp = null;
                foreach (EmployeeModel employee in _employees)
                {
                    if (employee.CardNO == CardNo)
                    {
                        emp = employee;
                        break;
                    }
                }
                return emp;
            }
        }

        public int Count
        {
            get
            {
                return _employees.Count;
            }
        }

    }
     */
}
